<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */

/**
 * Smarty {site_buttons} function plugin
 *
 * Type:     function<br>
 * Name:     site_buttons <br>
 *           the passed parameters
 *      (Smarty online manual)
 * @author Bhatu Pawar <bhatupawar85 at gmail dot com>
 * @param array
 * @param Smarty
 * @return string
 */

function smarty_function_site_buttons($params, &$smarty)
{
    //require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
	
	require_once DOC_ROOT."/model/website.php";

	$webObj = new Model_Website();	

	if($params["onclick"] != "")
	{
		$extraParams = " onclick=". $params["onclick"];	
	}

	$web_button_attribute = $webObj->getWebsiteAttribute_value($_SESSION[MY_SITE]['current_site_id'], $params["btn_attr_id"]);

	// Button color
	$web_button_color_attributeArray = $webObj->getWebsiteAttribute_value($_SESSION[MY_SITE]['current_site_id'], 5);
	//print_r($web_button_color_attributeArray);
	$web_button_color_attribute = $web_button_color_attributeArray["attribute_value"] ;

	$SubmitButtonCSS  = "background:#1f91d7 url(../images/black_gradient.png) repeat-x bottom; font: bold 13px 'Trebuchet MS', Arial, Helvetica, sans-serif;  text-align:center; padding:3px 6px; color:#fff;  cursor:pointer; border:0px solid #1972a9; text-shadow:#333 1px 1px; text-transform:uppercase; *+padding:3px 0px; background-color:$web_button_color_attribute;";

	$site_buttons = '<input type="'.$params["type"].'" id="'.$params["id"].'"  name="'.$params["name"].'" value="'.$web_button_attribute["attribute_value"].'" style="'.$SubmitButtonCSS.'"  ' ;

	$site_buttons .= $extraParams . " /> ";

	return $site_buttons;
}

/* vim: set expandtab: */

?>
